"use strict";
var app = getApp();
Page({
    data: {},
    bindGetUserInfo: function (e) {
        if(e.detail.userInfo) {
            wx.request({
                url: 'http://192.168.0.103:28089/wxUsers/login',
                method: "post",
                data: {
                    code: app.globalData.code,
                    iv: e.detail.iv,
                    encryptedData: e.detail.encryptedData
                },
                success: res => {
                    res = res.data;
                    if(res.code === "0") {
                        wx.setStorageSync('sessionId', res.data.sessionId);
                        wx.switchTab({
                          url: '../home/home',
                        })
                    } else {
                        wx.showToast({
                            title: res.message,
                        })
                    }
                },
                fail: err => {
                   throw err;
                }
            })
        }
    },
    bindGetUserPhone: function (e) {
        console.log(e);
    }
});